package com.jintu.portal.pojo.dto;

import com.jintu.portal.pojo.entity.TDepartment;
import com.jintu.portal.pojo.entity.TPost;
import com.jintu.portal.pojo.entity.TUser;
import com.jintu.portal.pojo.entity.TUserDepartmentPost;
import com.jintu.portal.utils.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Created by junhu on 2017/9/26.
 */
public class UserDepartmentPostDto implements Serializable {
    private Long userDepartmentId;//用户部门岗位Id
    private Long departmentId;//部门ID
    private Long userId;//用户Id
    private Integer isUsed;//是否可用1可用，0不可用
    private Long postId;//岗位ID
    // ---- 用户信息
    private String userName;//用户名
    private String realName;//用户昵称
    private Integer system;//所属系统(CA、OP、B App)
    private Date createTime;//创建时间
    private Long companyId;//企业ID
    private Integer status;
    private String birthday;
    private Date auditTime;//审核时间
    private Long auditor;//审核人
    private String auditorName;//审核人姓名
    private Integer addType;//角色类型 1 初始化 2 自主新增
    // ----- 部门信息
    private String fullName;//部门全称
    private String shortName;//部门简称
    private Long parentId;//上级部门ID
    private String parentName;//上级部门名称
    private Integer isStore;//是否门店
    private String storeText;//是否门店中文，门店或者非门店
    private String storePhone;//门店电话
    private String storeShopHour;//门店营业时间
    private String storeProvince;//门店所在省份
    private String storeCity;//门店所在城市
    private String storeDistrict;//门店所属区域
    private String storeAddress;//门店地址
    private Long departmentTypeId; //部门类型ID
    private String departmentTypeName;//部门类型名称
    private String fullPath;//部门类型名称
    // ----- 岗位信息
    private String postName;//岗位名称
    private Integer type;//岗位类型 1管理者，2员工
    //用户对应的部门岗位信息集合
    private List<UserDepartmentPostDto> departmentPostDtoList;
    private List<DepartmentDto> departmentChildrenList;//部门下的子集合
    private List<PostDto> postList;//崗位集合

    private Long bankAccountId;   //收款账户ID
    private Integer refundRight;  //退款权限 1为有权限

    public UserDepartmentPostDto(){

    }
    public UserDepartmentPostDto(TUserDepartmentPost userDepartmentPost) throws Exception {
        BeanUtils.copyProperties(userDepartmentPost, this);
        this.setIsUsed(userDepartmentPost.getIsUsed());
        this.setUserDepartmentId(userDepartmentPost.getId());
    }

    public UserDepartmentPostDto(TUserDepartmentPost tudp, TUser tu) throws Exception {
        BeanUtils.copyProperties(tudp, this);
        BeanUtils.copyProperties(tu, this);
        this.setIsUsed(tudp.getIsUsed());
        this.setUserDepartmentId(tudp.getId());
        this.setUserId(tu.getId());
        this.refundRight = tu.getRefundRight();
    }
    public UserDepartmentPostDto(TUserDepartmentPost userDepartmentPost, TDepartment department, TPost post, TUser user) throws Exception {
        BeanUtils.copyProperties(userDepartmentPost, this);
        BeanUtils.copyProperties(department, this);
        BeanUtils.copyProperties(post, this);
        BeanUtils.copyProperties(user, this);
        this.setIsUsed(userDepartmentPost.getIsUsed());
        this.setUserDepartmentId(userDepartmentPost.getId());
        this.setDepartmentId(department.getId());
        this.setPostId(post.getId());
        this.setUserId(user.getId());
        this.setUserName(user.getUsername());
        this.setRealName(user.getRealname());
        this.setPostName(post.getName());
        this.refundRight = user.getRefundRight();
    }

    public Long getUserDepartmentId() {
        return userDepartmentId;
    }

    public void setUserDepartmentId(Long userDepartmentId) {
        this.userDepartmentId = userDepartmentId;
    }

    public Long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getIsUsed() {
        return isUsed;
    }

    public void setIsUsed(Integer isUsed) {
        this.isUsed = isUsed;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Integer getSystem() {
        return system;
    }

    public void setSystem(Integer system) {
        this.system = system;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public Date getAuditTime() {
        return auditTime;
    }

    public void setAuditTime(Date auditTime) {
        this.auditTime = auditTime;
    }

    public Long getAuditor() {
        return auditor;
    }

    public void setAuditor(Long auditor) {
        this.auditor = auditor;
    }

    public String getAuditorName() {
        return auditorName;
    }

    public void setAuditorName(String auditorName) {
        this.auditorName = auditorName;
    }

    public Integer getAddType() {
        return addType;
    }

    public void setAddType(Integer addType) {
        this.addType = addType;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public Integer getIsStore() {
        return isStore;
    }

    public void setIsStore(Integer isStore) {
        this.isStore = isStore;
    }

    public String getStoreText() {
        return storeText;
    }

    public void setStoreText(String storeText) {
        this.storeText = storeText;
    }

    public String getStorePhone() {
        return storePhone;
    }

    public void setStorePhone(String storePhone) {
        this.storePhone = storePhone;
    }

    public String getStoreShopHour() {
        return storeShopHour;
    }

    public void setStoreShopHour(String storeShopHour) {
        this.storeShopHour = storeShopHour;
    }

    public String getStoreProvince() {
        return storeProvince;
    }

    public void setStoreProvince(String storeProvince) {
        this.storeProvince = storeProvince;
    }

    public String getStoreCity() {
        return storeCity;
    }

    public void setStoreCity(String storeCity) {
        this.storeCity = storeCity;
    }

    public String getStoreDistrict() {
        return storeDistrict;
    }

    public void setStoreDistrict(String storeDistrict) {
        this.storeDistrict = storeDistrict;
    }

    public String getStoreAddress() {
        return storeAddress;
    }

    public void setStoreAddress(String storeAddress) {
        this.storeAddress = storeAddress;
    }

    public Long getDepartmentTypeId() {
        return departmentTypeId;
    }

    public void setDepartmentTypeId(Long departmentTypeId) {
        this.departmentTypeId = departmentTypeId;
    }

    public String getDepartmentTypeName() {
        return departmentTypeName;
    }

    public void setDepartmentTypeName(String departmentTypeName) {
        this.departmentTypeName = departmentTypeName;
    }

    public String getFullPath() {
        return fullPath;
    }

    public void setFullPath(String fullPath) {
        this.fullPath = fullPath;
    }

    public String getPostName() {
        return postName;
    }

    public void setPostName(String postName) {
        this.postName = postName;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public List<UserDepartmentPostDto> getDepartmentPostDtoList() {
        return departmentPostDtoList;
    }

    public void setDepartmentPostDtoList(List<UserDepartmentPostDto> departmentPostDtoList) {
        this.departmentPostDtoList = departmentPostDtoList;
    }

    public List<DepartmentDto> getDepartmentChildrenList() {
        return departmentChildrenList;
    }

    public void setDepartmentChildrenList(List<DepartmentDto> departmentChildrenList) {
        this.departmentChildrenList = departmentChildrenList;
    }

    public List<PostDto> getPostList() {
        return postList;
    }

    public void setPostList(List<PostDto> postList) {
        this.postList = postList;
    }

    public Long getBankAccountId() {
        return bankAccountId;
    }

    public void setBankAccountId(Long bankAccountId) {
        this.bankAccountId = bankAccountId;
    }

    public Integer getRefundRight() {
        if(this.refundRight == null){
            this.refundRight = 0;
        }
        return refundRight;
    }

    public void setRefundRight(Integer refundRight) {
        this.refundRight = refundRight;
    }
}
